#include<stdio.h>

int main()
{
	char ch =0; //'A';
	int num =0;// 10;
	float f_num =0.0f;// 3.14f;


	FILE *fp = fopen("2.txt","r+");
	if(!fp){
		perror("fopen");
		return -1;
	}
	
/*	fwrite(&ch,1,1,fp);
	fwrite(&num,4,1,fp);
	
	fwrite(&f_num,4,1,fp);


	fread(&ch,1,1,fp);
	fread(&num,4,1,fp);
	fread(&f_num,4,1,fp);
*/

	//fprintf(fp,"%c %d %g",ch,num,f_num);

	fscanf(fp,"%c %d %g",&ch,&num,&f_num);

	printf("ch = %c,num = %d,f_num = %g\n",ch,num,f_num);

	fclose(fp);


	// 手动输出错误信息
	fprintf(stderr,"error!\n");


	return 0;
}